﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace Chapter04
{
    public partial class Example103 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var peachBlossom = File.OpenText(Server.MapPath("Example103.PeachBlossom.txt"));
                string readLine;
                while ((readLine = peachBlossom.ReadLine()) != null)
                {
                    Response.Write(readLine+"<br/>");
                }
                peachBlossom.Close();
            }
        }

        protected void countDown_Tick(object sender, EventArgs e)
        {
            var end = new DateTime(2017, 01, 01, 00, 00, 00, 00);
            var now = DateTime.Now;
            var expire = end.Subtract(now);
            dateTime.Text = "<b>距离 " + end + " 还有: " + "</b> " +
                expire.Days + " 天 " + expire.Hours + " 小时 " + expire.Minutes + " 分 " + expire.Seconds + " 秒";
        }
    }
}